I describe it to my clients this way. What you consume is the fuel used to move your body. If you put in junk, you’ll get junk out and won’t be able to do the things you’re asking your body to do. Exercise molds the body and changes it to adapt to the things you’re asking it to do. I don’t believe the two can exist without each other. So to answer your question, both diet (80% of the equation since you need good fuel to get good results) and exercise will lead to an improved body composition.
the management of body composition is more a matter of what the person does than what he eats even though a diet should be balanced between fat, carbs and protein to ensure proper energy sources and building blocks to repair and grow as necessary. Without exercise, a person can maintain ideal body weight and become over-fat.
However, there are other numbers that have a very close relationship to diet, and those are, for example, triglycerides and cholesterol. Even though genetics play a big role here, what one eats can impact those numbers significantly.