We present radiation-magneto-hydrodynamic simulations of star formation in self-gravitating, turbulent molecular clouds, modeling the formation of individual massive stars, including their UV radiation feedback. The set of simulations have cloud masses between $m_{rm gas}=10^3$~M$_odot$ to $3 times 10^5$~M$_odot$ and gas densities typical of clouds in the local universe ($overline n_{rm gas} sim 1.8times 10^2$~cm$^{-3}$) and 10$times$ and 100$times$ denser, expected to exist in high-redshift galaxies. The main results are: {it i}) The observed Salpeter power-law slope and normalisation of the stellar initial mass function at the high-mass end can be reproduced if we assume that each star-forming gas clump (sink particle) fragments into stars producing on average a maximum stellar mass about $40%$ of the mass of the sink particle, while the remaining $60%$ is distributed into smaller mass stars. Assuming that the sinks fragment according to a power-law mass function flatter than Salpeter, with log-slope $0.8$, satisfy this empirical prescription. {it ii}) The star formation law that best describes our set of simulation is $drho_*/dt propto rho_{gas}^{1.5}$ if $overline n_{gas}<n_{cri}approx 10^3$~cm$^{-3}$, and $drho_*/dt propto rho_{rm gas}^{2.5}$ otherwise. The duration of the star formation episode is roughly $6$ clouds sound crossing times (with $c_s=10$~km/s). {it iii}) The total star formation efficiency in the cloud is $f_*=2% (m_{rm gas}/10^4~M_odot)^{0.4}(1+overline n_{rm gas}/n_{rm cri})^{0.91}$, for gas at solar metallicity, while for metallicity $Z<0.1$~Z$_odot$, based on our limited sample, $f_*$ is reduced by a factor of $sim 5$. {it iv)} The most compact and massive clouds appear to form globular cluster progenitors, in the sense that star clusters remain gravitationally bound after the gas has been expelled.