That route takes you over the Bighorn Mountains. Doable, but steep in spots. If your plans include staying a day or two in Cody (Buffalo Bill Historical Center is AMAZING!), it's the best route. Whatever you do, do not take 14A to Burgess Junction. The Southern route you have planned , (over the Bighorns thru Ten Sleep and in to Buffalo) is the best route.
If you don't intend to stop in Cody and are just looking for the best route from Yellowstone to the Black Hills, just leave West Yellowstone and go north on 191 to Bozeman and pick up I-90 there. It will be a few miles longer, but a couple of hours shorter, especially if you take 212 from Garryowen (site of Little Bighorn Battle) over to Belle Fourche, SD then down to Sturgis.