Assuming the UA flight is on time, you'd have no issue making it. Even from B11 (furthest mainline gate) to A41, it only takes 10-15 min at most to walk (including the train ride) at an average pace. Add a few more minutes if you're at the back of the plane. Easily doable.
Now as far as your bags go, that's another issue. It'd be up to LH to send one of their interline runners out to your UA flight to pick them up. I'm guessing they would, since they have a dedicated guy for star alliance transfer bags...but you never know. If they didn't do that, then there is a much higher chance of them not making it.
It's certainly risky, but also very doable if things run on time. Given that there are so many flights between SFO and DEN, I'd personally look into one that gives a little more buffer. But only you can determine how much risk you are comfortable with.