Quick Answer
To convert grams to cups, you need two things: the ingredient and the cup standard. The formula is simple: cups = grams / (ingredient density x cup volume). Without the correct ingredient density, the result can be far off, especially for flour, sugar, and cocoa.
In day-to-day cooking, the easiest workflow is to select the ingredient first, choose US or metric cup once, and convert everything in one pass. That keeps your recipe consistent and avoids small rounding differences between steps.