How do you convert 12 milligrams to teaspoon?

There can be no equivalence.

A milligram is a measure of mass. A teaspoon is a measure of volume. The two measure different things and, according to basic principles of dimensional analysis, conversion from one to the other is not valid.

If you are not convinced, consider a teaspoon of water. How many milligrams? Next consider a teaspoon of oil. How many milligrams?

The masses of equal volumes of the two substances will clearly be very different. So there is no direct conversion between mass and volume: you need to know the density of the substance to enable you to carry out the conversion.