4 years is not the age to think that his brain has benn crystallized already and you cannot train him better social manners. Dog is a predator, and everuthing else in him works in combination with this major character. Dogs are deprived of that ability which seems very simple to us, and that is our human ability to classify, to put things into categories. Instead, they approach things individually. It is impossible that your male likes all people, and hates all dogs. Try to notice and specify particular occasions and circunstance, what people, and what those dogs were like. If he just lunges and barks - it doesn't mean he's agressive, he could be just scared of some unknown dog, or he obeys his simple predatory drive and simply wants some response from possible prey being unable to read that dogr body language due to the lack of experience with them. Many people were telling me that their dog is agressive, but in the end it happened that the reaction was caused by the leash holding them away from the object of interest. Then, if he is truly agressive - he would start to differentuate, say, a smaller ones he would like to hunt, females to supress and big males to destroy. So, in order to answer your question, it could be better to hear about that or other day experience.