Upcycling Models under Domain and Category Shift