There are actually a lot of different reasons for such cases. They can be categorized into internal and external factors. With the earlier one, you can easily attribute it to your state of mind or even health. If you always verge on the negative, it will be hard for you to be in a stress-free and good mood. A good way to overcome these would be to simply address the root cause and just aim to be involved in doing worthwhile activities.