Results of the ESO-SEST Key Programme on CO in the Magellanic Clouds. X. CO emission from star formation regions in LMC and SMC