Cubic zirconia is a different chemical compound, ZrO2. It exhibits very similar optical and physical properties as diamonds, but it is not the same and can easily be detected by an expert. It’s lot as hard (8.5 vs 10 on Moh’s scale), and it’s 1.7x heavier.
By contrast, lab created diamonds are just that - literal diamonds. They’re 100% carbon and almost indistinguishable from natural diamonds. It’s possible to do so using XRF and optical methods to detect nitrogen and inclusions, both of which lab diamonds lack.