It is necessary to know the density of the substance in question to be able to convert 125 grams to cups. This is because the gram is a unit of mass and the cup is a unit of volume. One can use the density to convert from mass to volume.
Using water as an example, it is possible to convert from grams of water to cups by using its density. Because water has a density of 1 gram per milliliter, 125 grams is equivalent to 125 grams * 1 milliliter/1 gram = 125 milliliters. One can convert from milliliters to cups by knowing that 1 cup is equivalent to 236.59 milliliters, or 236.59 cubic centimeters. This means that the 125 milliliters of water is equivalent to 125 milliliters * 1 cup/236.59 milliliters, or 0.52834 cups.
In another example, it is possible to convert grams of wheat flour to cups by using wheat flour's density of 0.593 grams per cubic centimeter. If there are 125 grams of wheat flour, this is equivalent to 125 grams * 1 cubic centimeter/0.593 grams * 1 cup/236.59 cubic centimeters, or 0.891 cups.