CSI 2264: Simultaneous optical and X-ray variability in the pre-main sequence stars of NGC 2264