Both cases are correct! To solve which one to use, you need to know a context. If you say "томатный сок", more likely that you mean a tomato juice in whole. E.g. "Я люблю томатный сок." And if you say "сок томата", more likely that you mean a juice from a definite tomato fruit. E.g. "Возьми сок одного томата и добавь его в..." However this is not strict. The accent moves to that or other side slightly. In a case when you have three and more genitives, it is better to use a combination Adjective and Genitive. E.g. "Я узнал это из статьи нью-йоркского журналиста" vs "Я узнал это из статьи журналиста из Нью-Йорка"