As @Nothing at all notes, this depends on the word.
On'yomi always use -OU for long O sound and kun'yomi almost always -OO.1
However, the real problem here is that you are being asked to reconstruct hiragana from Hepburn romanization. In general this is impossible, because Hepburn romanization conflates certain hiragana spellings. (There are romanization systems that don't.)
The fact that there are many homophones is probably one of the reasons that kanji still exist in Japanese. Without kanji and only hiragana, we would have that 糖衣、東夷、当為、等位、… would all be とうい.
Hepburn romanization goes even further, and also conflates とうい (e.g. 糖衣、東夷、当為、等位、…) and とおい (e.g. 遠い) to tōi.
So, you would need a lot of information to know that there is no word しょおゆ, so that shōyu would have to be しょうゆ. However, there would be no way for you to know (without context) whether tōi should be とうい or とおい.
The only way to solve this type of question is to know the hiragana spelling of the words that come up. (Well, it suffices to know the words in a romanization system that does not conflate hiragana spellings.)
All of that said, a long O (in Hepburn -ō) is more likely to be -OU, so the most economical approach would be to default to -OU for -ō and learn words with -OO such as とおい、とおる、おおい、おおきい、… as exceptions.
1 For kun'yomi there are rare exceptions that arise from a sound shift as in 妹【いもうと】 from いも+ひと which also occurs as a long O sound in 弟【おとうと】, 素人【しろうと】, 客人【まろうど】, 若人【わこうど】, 蔵人【くろうど】. Across "word boundaries" Hepburn romanization also uses -ou-; the above exceptions used to be word boundaries, but now they are not anymore, so they have a long O sound, romanized as -ō- in Hepburn.)