Most people can do it up to a certain point. The first year or two of training, as long as you train hard enough, you will most likely gain muscle and lose fat. The 3rd and 4th year, again as long as you train hard enough, you will most likely gain muscle and maintain bodyfat.
It will vary from person to person, the above is generally what happens.
Personally I gained muscle and lost or maintained BF for the first 5 years of training. After that, if I wanted to keep my BF lower, I had to keep my nutrition more and more in check.
Most all of the clients I have had over the years who wanted to gain muscle size did not have to worry much about nutrition in the first 1.5 - 2 years. (as long as they ate enough) After that we would have to dial things in more and more. In a way it is nice that things tend to work that way. It is much easier for people to get used to consistently training, then start changing nutrition habits. It can be overwhelming to do both at the same time.
The above is true for people who want to gain muscle mass. (that group tends not to have much of a BF issue) Those who are most interested in losing BF will generally have the best results learning good nutrition first, then working into a better and more consistent workout program.
(again, nothing is set in stone, I am merely stating the most common situations)
Like anything though, everything changes as you progress through your training career. The more gains you make, the more dialed in your training and nutrition needs to be. Very few people can avoid this.
What worked in the past most likely will not work in the future. The things you do to make good progress now will not work nearly as well in 2 or 3 years. Training (and nutrition) evolves over time. You just have to pay attention to how things are going.