Yes, you can.
The problem is that recess appointments are temporary, until the end of the next Senate session. They are not lifetime appointments.
If a Demoncrat President ever happens again, he would automatically get a Supreme Court nomination at that time. Such a recess appointment would be a highly unproductive use of an opportunity to select a Supreme Court Justice.
The same problem is of lesser concern for a cabinet post or any other appointment of one who serves at the pleasure of the President. A new President can replace them immediately upon taking office. There is little lost by using a recess appointment.
HF