RoboSpatial: Teaching Spatial Understanding to 2D and 3D Vision-Language Models for Robotics