A combination of both. Learn, play, learn more, play more.
The first few weeks getting into dota-like games is usually the hardest. The learning curve is extremely steep, and the community is unforgiving to the noobs. But this is justified, as a single newbie on the team could cost the other 4 players 30-60 minutes of his life.
You cannot avoid being a newbie, but you can make it smoother and more forgiving if you are willing to spend some extra time learning:
- Understand the basics of the game
The most important thing is to learn about the heroes, and what can they do / what are their capabilities. You don't need to learn how to play most/every hero, but make sure you know what most/every hero can do. Then learn about the items. What they can do, and who uses them best
Then after knowing the basics, choose one and learn more about him. Read a guide about him thoroughly. Go play with some AIs. If you win, identify what you did different / what your team did that brought you the victory. If you lost, understand why you lost.
Dota is a game of learning. You learn from each game you play, win or lose. The more you learn however, the less you lose. - Familiarize yourself with the game
Don't linger in AIs too long. After you more or less understand the basics of the game and are familiar with it (know what pushes and ganks are, understood what your hero can do, etc) it's time to play for real, against other players.
This is when the fun starts. Players will flame you, and you will endure it. No matter how much time you spend with AIs, you're bound to have a bad game once in a while. You need to endure it, however. Playing with humans gives you a better overview on the game than with AIs. If you're lucky, you might also get someone nice enough to teach you. If you're very lucky.
Playing with humans is much less forgiving, but gives much more knowledge. Endure the flaming and focus on learning. - Start trying something new and expand your knowledge
You're familiar with the game. Now you're not the main reason of your team's losses anymore.Now's the time to expand your repertoire. Don't be afraid to try new heroes, unless it's meepo or invoker or something.
Learn new heroes. Learn new strategies. Don't be limited to guides, go to forums. Some guides are outdated, but forums rarely are, and they provide an interesting insight. Most important fo all,
There is a difference between knowing and having played a hero. The more skilled you are with a hero, the more skilled you are against that hero. - Good luck.