In theory, yes, but in reality, many people on this route won't end up finishing the university portion in just two years. You end up being in school for a total of least 5 years (2 community and 3 university). Two big reasons:
Pre-reqs. Often times majors will have a long series of courses that must be complete be completed in successive order. The problem: the earlier classes in the series aren't always offered at tech/community colleges -- especially with STEM majors. For example, the local tech college by me has several different programming courses, but not a formal Algorithms course... which is an earlier course in a university CS sequence. More importantly, even if they do offer it, it often isn't as rigorous. You end up cheating yourself.
General reqs - Universities continue to change and refine these each year, meaning fewer and fewer courses are transferring -- and that's more money for them! The community and tech colleges don't always have the right courses you need either.