pksm legality question(legal/illegal pokemon, not legality of the service)

so i have heard that transferring pokemon from, for example, gen 6 to gen 7, they will still be completely legitimate. however, the same source, said that if you do 7 to 6, they will probably be illegal, since you could do things in gen 7 you couldn't in gen 6.

but I want to know, if I transfer pokemon from HGSS to DPPt, will they still be legal?(only pokemon
in DPPt could be transferred of course). i ask because not only are these the same gen, but i believe there were no fundamental changes between games.

and if it is possible, would there be any prerequisites, etc. required? could only some pokemon be transferred?