What are benefits of accordion over tabs and vice-versa?
Although both of them are supported in many Javascript UI frameworks/libraries, you can see example here: http://jqueryui.com/demos/
For me they serve pretty same purpose (to hide complexity), except accordion is IMHO better for "continuous-reading", it's easier to quickly go to next section, while Tabs seems to be more "random-access"
What's their benefits, when should I prefer one over the latter one? (from the UX point of view, I don't care about horizontal/vertical and html code differences)
According to repost on UX, accordions have a fixed height and have to fit the whole screen (see example) - this allows for the easy selection of any section (we don't want to scroll up/down to select other sections as I thought). I've completely missed that.
Tabs on the other hand can have different heights (although it's better idea to fix their height too and provide scrollbars). Tab headers, unlike accordion ones, stay in place after selection.
Accordions are best suited for mobile devices, where there isn't enough space for horizontal tabs and vertical tabs would require the user to turn their head to read the headers. "moving headers" are the form of necessary evil in this case.