I have a friend who does both and I played around with Treibball with my herding dogs a bit (although we weren't really doing much herding at the time), and I think it can be done. However, my friend and I both used different commands for Treibball than we did herding.
I agree with Mutt too that I'd get really good at one before I moved on to the other. Although I guess it depends a bit on your goals...are you planning on seriously competing/trialling with either, or are you just out to have fun? If you don't really care about being competitive and just want some fun activities to do with your dog, then I don't know how important that is.
Basically, the two are different enough that I don't think most dogs will get that confused, but they're similar enough that they could learn "bad" habits that transfer from one to another. To use an example mentioned above, a dog might learn that touching the ball is really fun and makes it move, and think that touching the sheep will be really fun too. It's not generalizing in the sense that he thinks "herding means I touch the subject" but the behavior still transfers because he learns it may be rewarding to do so, if that makes sense. That's another reason for using different commands, too. He learns that one set of commands has one set of rules, and the other has some different rules.
A ball is really different than a sheep and a dog isn't going to confuse the two of course, but Treibball and herding definitely use the same drives, and that can cause some wires to get crossed if you're not careful about it.