You may only switch positions once the ball has been contacted by the server. If you leave your spot too early, your team will be called out of rotation and the other team will automatically win a point. You almost never switch between front row and back row.