It's possible but you'll need to short your Universal time considerably. The observatory is open till 10pm. They're only under 30 minutes apart and you're probably taking the 5 back to Anaheim.
Especially when there's an event at the Greek Theatre. The observatory parking lot is only available for event parking. I went on an event night by bus and the traffic was insane. The bus I took crawled along, and we also had preferred access.