Why does it seems in similar cases sometimes classic conditioning happens and in others habituation?
The Wikipedia article on Habituation explains it fairly well:


  The habituation process is a form of adaptive behavior (or neuroplasticity) that is classified as nonassociative learning. Nonassociative learning is a change in a response to a stimulus that does not involve associating the presented stimulus with another stimulus or event such as reward or punishment.[4] (Examples of associative learning include classical conditioning and operant conditioning). Habituation is the decrease of a response to a repeated eliciting stimulus that is not due to sensory adaption or motor fatigue.


Classical Conditioning strengthens associations and elicits a response because the stimulus is associated with something. The bell means food, pay attention to it. Habituation happens when there's no association; why keep getting worked up by the church bells ringing when you know it doesn't mean anything important (as opposed to a tornado siren).

To generalize "classical conditioning" further into just "associative learning", they're two sides of the same coin; if something is important, connections in your mind strengthen; you remember and a response is illicited. If something isn't important, you stop caring about it and might fail to notice the stimulus at all. This is why excessive fire drills (and worse, false alarms) can be a bad thing; many college students end up being habituated against fire alarms rather than being classically conditioned to know "loud noise" -> "get the heck out".