The energy level of C's and O's atomic orbitals in this diagram are quite similar.
But another one shows that the energy difference is quite large that gives another pattern.
As you know, it is due to electronegative difference between C and O, but in what extent?
If small, properly, it's just same as your case, if large, it will be another case.