COS from B2 to H4

My spouse is on H1B , Visa expired in Feb 2020, but got renewed in June 2020, so did my H4. I had to travel to India on some urgent matter in March 2020. I have a valid B2 Visa too. Can I travel to US and get COS done there from B2 to H4 and how long does it take ?