The homotopy type of associative and commutative algebras