"cm" is the abbreviation for 'centimeter', a unit of length or distance.
"mg" is the abbreviation for 'milligram', a unit of mass.
These two units measure different quantities. Their physical dimensions
are different, and neither can be converted to the other.
If length could be converted to mass, then it would be possible for you
or some other math-whiz to calculate how many kilograms you ride to
school every day.