Teacher training courses teaches you how to teach, rather than teaching you how to teach specific age ranges or subjects. Therefore, once considered a qualified teacher, you may teach any age range and any subject.
However, where the transition poses a challenge is in demonstrating any experience with differing age ranges and curriculum at interview. As there are no additional courses once awarded QTS, you would need to seek opportunities to develop experience with differing age groups. A simple way to do so is to complete some supply teaching or work in alternative education settings.
Quite frequently, people who teach one phase wouldn't consider changing, but there are lots of examples where people do make this transition.
All the best, Jane
However, you'd likely find moving to secondary school pretty difficult, as the level of subject specialism and curriculum knowledge is much higher than primary.
I do know teachers who have made the jump, though and it is possible especially in a shortage subject.
You'd generally need to get some experience with the other age group e.g. through supply before you'd be considered for many roles.