The robot in this particular trailer is likely a CGI model. Here is some speculation, and of all versions, the one with mostly empty head magneted to a rod inside the ball seems more or less plausible. But as you can see, the head jumps around a lot. Magnetic force weakens quickly with increasing distance between magneted surfaces, so when the head jumps around, it would likely lose almost all of the attraction and fall off. To keep it upright, we need more powerful magnets, but they'd likely just stick the head to a single point on the ball, moving together with it, and it would lose the ability to ride always-on-top.
As for the version with a robotic head, balancing a kinematically unstable platform is a common problem in robotics. Is can be solved with dynamic stabilization algorithms - that is what allows ATLAS, Rezero, Double and numerous other robotic platforms to keep it upright, together with arrays of sensors (gyroscopes+accelerometers) and actuators that are quick enough to respond to sudden disturbances of equilibrium. But still, a fast and bumpy ride like this is a tough challenge, so I highly doubt that it could be a physical robot. Also, does the FX team really need to invent such a highly advanced robot for only a few scenes (those fast-and-bumpy), especially considering the Lucasfilm' love for CGI in the recent SW movies? I doubt so.
As for the robot in the celebration panel, as well as the prop used in less dynamic scenes, it could easily be one of the technologies mentioned above (again, most likely magnets, not a balancing platform).
Possible BB-8 mechanism taken from above link:
