There are two basic principles at work here. First "you are where you came from". Which would be a violation in the first instance. As someone earlier said, that could be overlooked by the ref. However, what if there was a full court press and it was inbounded that way?
In the second instance, you have "the rule of verticality". Each offensive and defensive player has a right to their space from the floor to the rafters. It was called a foul in the technical sense, but not the spirit of the rule if no contact was made.