Quillen cohomology and Baues-Wirsching cohomology of algebraic theories